<template>
    <div>
        <div id="head">
            <p>搜索发现</p>
            <van-icon id="right" name="eye-o" />
        </div>
        <div id="body">
            <div v-for="item in newsList" :key="item.id">
                {{item.title}}
            </div>
        </div>
    </div>
</template>

<script>
import { getApi } from "@/util/api.js";
export default {
  name: "NewsList",

  data() {
    return {
      newsList: [],
      count: 1,
    };
  },

  mounted() {
    this.getNewsList();
  },

  methods: {
    getNewsList() {
      let url = "https://d.app3c.cn/mcm/api/SearchFind/";
      getApi(url).then((res) => {
        this.newsList = res.data;
        console.log(this.newsList);
      });
    },
    goto(id) {
      this.$router.push({ name: "detail", params: { id } });
    },
  },
};
</script>

<style lang="scss" scoped>
    #head{
        width: 100%;
        margin-top: 2.5vw;
        margin-bottom: 2vw;
        display: flex;
        p{
            font-weight: bold;
            font-size: 5vw;
            padding-left: 3vw;
        }
        #right{
            left: 68vw;
            font-size: 5vw;
            padding-top: 1vw;
        }
    }
    #body{
        width: 90%;
        margin-top: 4vw;
        margin-bottom: 3vw;
        display: flex;
        flex-wrap: wrap;
        div{
            background: rgba(245, 244, 244, 0.99);
            width:fit-content;
            width:-webkit-fit-content;
            width:-moz-fit-content;
            border-radius: 10%;
            font-size: 4vw;
            margin-left: 7vw;
            margin-bottom: 3vw;
        }
    }
</style>